package com.hhkj.captcha.controller;

import com.hhkj.captcha.model.req.SendCaptchaReq;
import com.hhkj.captcha.service.biz.ApiCaptchaBizService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.apache.http.protocol.HTTP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * ApiCaptchaController
 *
 * @author HHKJ-SERVER-ZJ
 * @since 2023/10/25 8:29
 */
@RestController
@RequestMapping("/api/captcha")
public class ApiCaptchaController {

    @Autowired
    private ApiCaptchaBizService captchaBizService;

    /**
     * 获取验证码
     */
    @PostMapping()
    public AjaxResult captcha(@Validated @RequestBody SendCaptchaReq req, HttpServletRequest request) {
        captchaBizService.captcha(req, request);
        return AjaxResult.success();
    }
}
